#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    int n;
    int m;
    int a;
    int b;
    int c;
    int sum;
    for (n = 10000; n < 100000; n++)
    {
        m = n; sum = 0;
        for (c = 10; c < 100000; c *= 10)
        {
            a = m / c; b = m % c;
            sum += a * b;
        }
        if (sum == n)
            cout << sum << " ";
    }
    return 0;
}